package net.hnedu.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;
import javax.servlet.jsp.JspTagException;
import net.hnedu.factory.ResDisplay;

public class ResInfoTag extends TagSupport {
  public ResInfoTag() {
  }

  private String columnId;
  private String number;
  private String headerImage = "";
  private String css = "";
  private boolean showtime = true;
  private String moreStr = "";

  public int doStartTag() throws JspException {
    try {
      JspWriter out = pageContext.getOut();
      String str = ResDisplay.displayInfo(Integer.parseInt(columnId),
                                          Integer.parseInt(number),
                                          headerImage,
                                          css,
                                          showtime,
                                          moreStr);
      out.write(str);
    }
    catch (IOException e) {
      throw new JspTagException(e.getMessage());
    }
    return EVAL_PAGE;
  }
  public void setColumnId(String columnId) {
    this.columnId = columnId;
  }
  public void setCss(String css) {
    this.css = css;
  }
  public void setHeaderImage(String headerImage) {
    this.headerImage = headerImage;
  }
  public void setMoreStr(String moreStr) {
    this.moreStr = moreStr;
  }
  public void setNumber(String number) {
    this.number = number;
  }
  public void setShowtime(boolean showtime) {
    this.showtime = showtime;
  }
}
